package com.xsjt.job;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 任务调度
 * @author Administrator
 * 
 * @Seheduled注解表示，这个方法是一个任务调度方法
 */
@Component
public class ScheduledTasks {

	private static final Logger logger = LoggerFactory.getLogger(ScheduledTasks.class);
	
	private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	@Scheduled(initialDelay = 10000, fixedRate = 2000)
	public void oneJob() {
		logger.info("当前时间：" + sdf.format(new Date()));
	}
}
